/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package corba;

import BusinessLogic.MedicineBL;
import BusinessLogic.MyQueryBL;
import BusinessLogic.PatientBL;
import Ch.Elca.Iiop.GenericUserException;
import Model.Medicine.MedUnit;
import Model.Patient;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;

/**
 *
 * @author Paul
 */
public class test {

    private static CorbaConnection corbaConnection;
    public static void main(String[] args) throws GenericUserException, NamingException, FileNotFoundException, IOException, ClassNotFoundException {
        
        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
        env.put(Context.PROVIDER_URL, "iiop://192.168.137.106:6969");
        
        Context context = new  InitialContext(env);

        MedicineBL myQueryBL;
        Object objRef = context.lookup("MedicineBL");
        myQueryBL=   (MedicineBL)  PortableRemoteObject.narrow(objRef,MedicineBL.class);
        
        
        MedUnit s = myQueryBL.getMedUnit(1);
        System.out.print(s.getMedUnitName());
    }
}
